<?php

use Illuminate\Database\Migrations\Migration;

class Projects extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		// Create projects table
		Schema::create("projects", function($table)
		{
			// indentifiers
			$table->increments("id");

			// decriptors
			$table->string("title");
			$table->string("slug");
			$table->text("body");

			// soft deletes
			$table->softDeletes();

			// timestamps
			$table->timestamps();
		});
		
		//
		Schema::create("project_images", function($table)
		{
			$table->increments("id");
			$table->text("imagefilename");
			
			// soft deletes
			$table->softDeletes();
			
			// timestamps
			$table->timestamps();
		});
		//
		Schema::create("project_project_images", function($table)
		{
			$table->increments("id");
			$table->integer("projectid");
			$table->integer("imageid");
			
			// soft deletes
			$table->softDeletes();
			
			// timestamps
			$table->timestamps();
		});
		
		Schema::create("project_files", function($table)
		{
			$table->increments("id");
			$table->text("filename");
			
			// soft deletes
			$table->softDeletes();
			
			// timestamps
			$table->timestamps();
		});
		//
		Schema::create("project_project_files", function($table)
		{
			$table->increments("id");
			$table->integer("projectid");
			$table->integer("fileid");
			
			// soft deletes
			$table->softDeletes();
			
			// timestamps
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop("projects");
		Schema::drop("project_images");
		Schema::drop("project_project_images");
		Schema::drop("project_files");
		Schema::drop("project_project_files");
	}

}